--===================================================--
---- Events for handling keyboard and touch screen ----
--===================================================--

local function onTouchesBegin(event)
	printTouches("BEGIN", event)

	local dot = dots[event.touch.id]
	if dot then
		stage:addChild(dot)
		dot:setPosition(event.touch.x, event.touch.y)
	end
end

local function onTouchesMove(event)
	printTouches("MOVE", event)

	local dot = dots[event.touch.id]
	if dot then
--		dot:setPosition(event.touch.x, event.touch.y)
	end
end

local function onTouchesEnd(event)
	printTouches("END", event)

	local dot = dots[event.touch.id]
	if dot and stage:contains(dot) then
--		stage:removeChild(dot)
	end
end

local function onTouchesCancel(event)
	printTouches("CANCEL", event)

	local dot = dots[event.touch.id]
	if dot and stage:contains(dot) then
--		stage:removeChild(dot)
	end
end

stage:addEventListener(Event.TOUCHES_BEGIN, onTouchesBegin)
stage:addEventListener(Event.TOUCHES_MOVE, onTouchesMove)
stage:addEventListener(Event.TOUCHES_END, onTouchesEnd)
stage:addEventListener(Event.TOUCHES_CANCEL, onTouchesCancel)